import { createRequest } from '/@/api/service';
const module = 'ib/base/v1/SysDictApi';

/**
 * @function 根据父级编码查询字典(仅仅支持父级编码visit_dept)
 * @param data
 * @param header
 * @returns {Promise}
 */
function QUERY_DICT_BY_PARENT_CODE(
  data: SysDictApi.QueryDictByParentCodeReq,
  header: object = {},
): Promise<SysDictApi.QueryDictByParentCodeResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}/open/queryDictByParentCode`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 通过父级的字典编码或者是父级的字典ID查询子集字典列表(只查一级)
 * @param data
 * @param header
 * @returns {Promise}
 */
function QUERY_DICT_BY_PARENT_ID(
  data: SysDictApi.QueryDictByParentIdReq,
  header: object = {},
): Promise<SysDictApi.QueryDictByParentIdResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}/queryDictByParentId`,
    data,
    header,
    'POST',
  );
}

export { QUERY_DICT_BY_PARENT_CODE, QUERY_DICT_BY_PARENT_ID };
